package com.aaa.service.impl;

import com.aaa.entity.LayTreeData;
import com.aaa.entity.Menu;
import com.aaa.entity.User;
import com.aaa.mapper.MenuMapper;
import com.aaa.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuMapper menuMapper;

    /**
     * 查询菜单的业务
     * @return
     */
    @Override
    public List<Menu> showMenu(User user) {
        Integer rid = user.getRid();
        List<Menu> menu = menuMapper.findMenu(rid);
        return menu;
    }

    /**
     * 获取所有的树状菜单
     * @return
     */
    @Override
    public List<LayTreeData> getAllTreeMenu() {
        return menuMapper.findAllTreeData();
    }

    /**
     * 获取该用户的树状菜单
     * @param rid
     * @return
     */
    @Override
    public List<Integer> findRoleMenu(Integer rid) {
        List<Integer> integers = menuMapper.findroleMenuid(rid);
        return integers;
    }
}
